var baseUrl  = 'http://47.108.197.28:3000'
/* 封装复杂,接口简单 */
function http(url){
   return new Promise((resolve,reject)=>{
       wx.request({
           url:baseUrl+url,
           header: {'content-type':'application/json'},
           method: 'GET',
           dataType: 'json',
           responseType: 'text',
           success: (res)=>{
               resolve(res)
           },
           fail: (err)=>{
               reject(err);
           }
       });
   })
}
function getSearchHttp(keyword){
    return http(`/search?keywords=${keyword}`)
}
function getMvHttp(){
    return http("/mv/first")
}
function getMvDetailHttp(id){
    return http(`mv/url?id=${id}`)
}
module.exports = {
    getMvHttp,
    getMvDetailHttp,
    getSearchHttp
}